#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int com_int(const void* p1, const void* p2)
{
    return (*(int*)p2) - (*(int*)p1);
}
int main()
{
    int n = 0;
    scanf("%d", &n);
    int i = 0;
    int arr[50] = { 0 };
    for (i = 0; i < n; i++)
    {
        scanf("%d ", &arr[i]);
    }
    size_t sz = sizeof(arr) / sizeof(arr[0]);
    qsort(arr, sz, sizeof(arr[0]), com_int);
    for (i = 0; i < 5; i++)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}